<template>
	<view class="p2432">
		<view class="mt120">
			<view class="pr flex_c">
				<image class="img" src="/static/index/serve/stateBg.png" mode=""></image>
				<view class="pa title c2a7 fw600">{{type=='normal'?'营 业 中':'休 息 中'}}</view>
			</view>
			<view class="mt24 tc c3 fw500 fs26">
				<text v-if="type=='normal'">您当前店铺处于营业中，正常接收订单</text>
				<text v-else>当前店铺已停止提供服务，不可接受任何订单，手动恢复营业后可正常接受新订单</text>
			</view>
			<view class="mt60 flex_y">
				<view class="btn flex_c cf fw500 fs26" @click="operate">{{type=='normal'?'停止营业':'恢复营业'}}</view>
			</view>
			<view class="mt24 c2a7 fw500 fs26">
				<view class="" v-if="type=='normal'">当您希望长时间不再接收订单时，请点击上方按钮停止营业，停止后需手动开启</view>
				<view class="" v-else>当您希望接受新订单时，请点击上方按钮恢复营业</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		components: {},
		data() {
			return {
				type: 'normal', //normal营业中 hidden休息
			}
		},
		onLoad(options) {
			if (options.type) {
				this.type = options.type
			}
		},
		onShow() {

		},
		methods: {
			operate() { //操作
				this.$api.shopEdit({
					status: this.type == 'normal' ? 'hidden' : 'normal'
				}).then(res => {
					if (res.code == 1) {
						uni.navigateBack()
						uni.$emit('refresh', true)
					} else {
						uni.$u.toast(res.msg)
					}
				})
			}
		},
		computed: {

		},
		watch: {

		}
	}
</script>

<style lang="scss" scoped>
	.img {
		width: 448upx;
		height: 391upx;
	}

	.title {
		top: 45%;
		left: 50%;
		transform: translate(-50%, 45%);
		font-size: 68upx;
	}

	.btn {
		width: 687upx;
		height: 80upx;
		background: #2A71C0;
		border-radius: 40upx;
	}
</style>
